fix(state): operation argument in provide/process#4712
Conversation
| use Doctrine\ORM\EntityManagerInterface; | ||
| use Doctrine\Persistence\ManagerRegistry; | ||
|
|
||
| class DoctrineOrmResourceCollectionMetadataFactory implements ResourceMetadataCollectionFactoryInterface |
There was a problem hiding this comment.
| class DoctrineOrmResourceCollectionMetadataFactory implements ResourceMetadataCollectionFactoryInterface | |
| final class DoctrineOrmResourceCollectionMetadataFactory implements ResourceMetadataCollectionFactoryInterface |
|
|
||
| class DoctrineOrmResourceCollectionMetadataFactory implements ResourceMetadataCollectionFactoryInterface | ||
| { | ||
| private $decorated; |
There was a problem hiding this comment.
drop php 7.1 and yes if not we can't or as phpdoc
| private function getProvider(AbstractOperation $operation): string | ||
| { | ||
| if ($operation instanceof CollectionOperationInterface) { | ||
| return 'api_platform.doctrine.orm.state.collection_provider'; |
There was a problem hiding this comment.
We should alias these services with the FQCN, and use it here. This will remove the hard coupling with Symfony.
There was a problem hiding this comment.
I tried just aliasing and it doesn't work with tags + service locators this was a quick fix I need to use the class as id
|
|
||
| namespace ApiPlatform\Metadata; | ||
|
|
||
| abstract class AbstractOperation |
There was a problem hiding this comment.
| abstract class AbstractOperation | |
| abstract class Operation |
The API will be nicer, and this is consistent with the newest coding convention used in Symfony.
There was a problem hiding this comment.
I know right, but we need to rename the current one then
There was a problem hiding this comment.
Not an issue as this was never released isn't it?
| use ApiPlatform\Metadata\AbstractOperation; | ||
| use Psr\Container\ContainerInterface; | ||
|
|
||
| class CallableProcessor implements ProcessorInterface |
There was a problem hiding this comment.
| class CallableProcessor implements ProcessorInterface | |
| final class CallableProcessor implements ProcessorInterface |
| public function provide(AbstractOperation $operation, array $uriVariables = [], array $context = []) | ||
| { | ||
| $operation = $context['operation'] ?? null; | ||
| exit('hello'); |
There was a problem hiding this comment.
on purpose I need to fix this
| use ApiPlatform\Metadata\AbstractOperation; | ||
| use ApiPlatform\State\ProcessorInterface; | ||
|
|
||
| class ServiceLocatorProcessor implements ProcessorInterface |
There was a problem hiding this comment.
| class ServiceLocatorProcessor implements ProcessorInterface | |
| final class ServiceLocatorProcessor implements ProcessorInterface |
And as this class doesn't depend on Symfony, it could be placed in the top-level namespace.
d7a9eb2 to
ebb6151
Compare
372bd07 to
6ccbaa3
Compare
Review the state provider and processor interfaces. Move provider/processor on the Operation.